package com.minimalist.common.entity.lindi.vo.tradeapplicationapprovefile;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.entity.basic.vo.file.FileVO;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;


import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 林地指标交易平台_交易申请审批文件 VO实体
 *
 * @author 11987
 */
@Schema(name = "林地指标交易平台_交易申请审批文件实体")
public class LindiTradeApplicationApproveFileVO implements Serializable{

    @Serial
    private static final long serialVersionUID = 1L;

    // 基本信息
    @NotNull(message = "交易申请ID不能为空", groups = {Update.class, Add.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "tradeApplicationId", description = "交易申请ID", type = "string")
    private Long tradeApplicationId;

    @NotNull(message = "审批文件ID不能为空", groups = {Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "approveFileId", description = "审批文件ID", type = "string")
    private Long approveFileId;

    @NotBlank(message = "审批文件名称不能为空", groups = {Add.class, Update.class})
    @Schema(name = "approveFileName", description = "审批文件名称", type = "string")
    private String approveFileName;

    // 文件信息
    @NotNull(message = "文件ID不能为空", groups = {Add.class, Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "fileId", description = "文件ID", type = "string")
    private Long fileId;

    @Schema(name = "file", description = "文件信息", type = "object")
    private FileVO file;

    // 审计字段
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "createId", description = "创建人ID", type = "string")
    private Long createId;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "updateId", description = "更新人ID", type = "string")
    private Long updateId;

    @Schema(name = "createTime", description = "创建时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime createTime;

    @Schema(name = "updateTime", description = "更新时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime updateTime;

    public LindiTradeApplicationApproveFileVO() {
    }

    public LindiTradeApplicationApproveFileVO(Long tradeApplicationId, Long approveFileId, String approveFileName, Long fileId, FileVO file, Long createId, Long updateId, LocalDateTime createTime, LocalDateTime updateTime) {
        this.tradeApplicationId = tradeApplicationId;
        this.approveFileId = approveFileId;
        this.approveFileName = approveFileName;
        this.fileId = fileId;
        this.file = file;
        this.createId = createId;
        this.updateId = updateId;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }

    public Long getTradeApplicationId(){
        return tradeApplicationId;
    }

    public void setTradeApplicationId(Long tradeApplicationId){
        this.tradeApplicationId = tradeApplicationId;
    }

    public Long getApproveFileId(){
        return approveFileId;
    }

    public void setApproveFileId(Long approveFileId){
        this.approveFileId = approveFileId;
    }

    public String getApproveFileName(){
        return approveFileName;
    }

    public void setApproveFileName(String approveFileName){
        this.approveFileName = approveFileName;
    }

    public Long getFileId(){
        return fileId;
    }

    public void setFileId(Long fileId){
        this.fileId = fileId;
    }

    public FileVO getFile(){
        return file;
    }

    public void setFile(FileVO file){
        this.file = file;
    }

    public Long getCreateId(){
        return createId;
    }

    public void setCreateId(Long createId){
        this.createId = createId;
    }

    public Long getUpdateId(){
        return updateId;
    }

    public void setUpdateId(Long updateId){
        this.updateId = updateId;
    }

    public LocalDateTime getCreateTime(){
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime){
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime(){
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime){
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o){
        if (o == null || getClass() != o.getClass()){
            return false;
        }
        LindiTradeApplicationApproveFileVO that = (LindiTradeApplicationApproveFileVO) o;
        return Objects.equals(tradeApplicationId, that.tradeApplicationId)
                && Objects.equals(approveFileId, that.approveFileId)
                && Objects.equals(approveFileName, that.approveFileName)
                && Objects.equals(fileId, that.fileId)
                && Objects.equals(file, that.file)
                && Objects.equals(createId, that.createId)
                && Objects.equals(updateId, that.updateId)
                && Objects.equals(createTime, that.createTime)
                && Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode(){
        return Objects.hash(tradeApplicationId, approveFileId, approveFileName, fileId, file, createId, updateId, createTime, updateTime);
    }

    @Override
    public String toString(){
        return "LindiTradeApplicationApproveFileVO{" +
                "tradeApplicationId=" + tradeApplicationId +
                ", approveFileId=" + approveFileId +
                ", approveFileName='" + approveFileName + '\'' +
                ", fileId=" + fileId +
                ", file=" + file +
                ", createId=" + createId +
                ", updateId=" + updateId +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private Long tradeApplicationId;
        private Long approveFileId;
        private String approveFileName;
        private Long fileId;
        private FileVO file;
        private Long createId;
        private Long updateId;
        private LocalDateTime createTime;
        private LocalDateTime updateTime;

        public Builder tradeApplicationId(Long tradeApplicationId) {
            this.tradeApplicationId = tradeApplicationId;
            return this;
        }

        public Builder approveFileId(Long approveFileId) {
            this.approveFileId = approveFileId;
            return this;
        }

        public Builder approveFileName(String approveFileName) {
            this.approveFileName = approveFileName;
            return this;
        }

        public Builder fileId(Long fileId) {
            this.fileId = fileId;
            return this;
        }

        public Builder file(FileVO file) {
            this.file = file;
            return this;
        }

        public Builder createId(Long createId) {
            this.createId = createId;
            return this;
        }

        public Builder updateId(Long updateId) {
            this.updateId = updateId;
            return this;
        }

        public Builder createTime(LocalDateTime createTime) {
            this.createTime = createTime;
            return this;
        }

        public Builder updateTime(LocalDateTime updateTime) {
            this.updateTime = updateTime;
            return this;
        }

        public LindiTradeApplicationApproveFileVO build() {
            return new LindiTradeApplicationApproveFileVO(
                    tradeApplicationId,
                    approveFileId,
                    approveFileName,
                    fileId,
                    file,
                    createId,
                    updateId,
                    createTime,
                    updateTime
            );
        }
    }
}
